#ifndef SESSION_EVENT_HANDLER_H
#define SESSION_EVENT_HANDLER_H
#include "net_module.h"

class CProxy;
class CSessionEventHandler :
    public utility::network::session_event_handler
{
public:
    // explicit constructor
    CSessionEventHandler(utility::network::session * s);

    // standard destructor
    ~CSessionEventHandler(void);
    // when received data from net work
    virtual void on_receive(const char * message, uint32 message_length);

    // when successfully established connection
    virtual void on_established();

    // when lost the connection
    virtual void on_disconnected();

    // when any error occurred
    virtual void on_error(int32 error_code, const char * error_message);

    void send(void * message, size_t message_length);

    void SetProxy(CProxy * pProxy);

    void Disconnect();

    uint32 GetIPAddr();

    uint16 GetPort();
private:
    utility::network::session * m_pSession;
    CProxy * m_pProxy;
};

#endif // endif of SESSION_EVENT_HANDLER_H

